<template>
  <div class="personal-center">
    <div class="profile-card">
      <el-avatar :icon="User" size="large" class="avatar" />
      <div class="profile-info">
        <div class="username">
          {{ user.username
          }}<el-tag type="success" effect="dark" style="margin-left: 10px"
            >Lv.{{ user.level }}</el-tag
          >
        </div>
        <div class="signature">{{ user.signature }}</div>
      </div>
      <div class="profile-stats">
        <div>
          <span class="stat-num">{{ user.following }}</span>
          <span class="stat-label">关注</span>
        </div>
        <div>
          <span class="stat-num">{{ user.followers }}</span>
          <span class="stat-label">粉丝</span>
        </div>
        <div>
          <span class="stat-num">{{ user.favorites }}</span>
          <span class="stat-label">收藏</span>
        </div>
      </div>
      <div class="edit-btn">
        <el-button type="primary" plain>编辑</el-button>
      </div>
    </div>
    <div class="personal-actions">
      <el-container>
        <el-aside class="personal-aside" width="200px">
          <div
            class="personal-tabs"
            v-for="(tab, index) in tabs"
            :key="index"
            style="margin-bottom: 12px"
          >
            <el-button class="personal-tab-btn" type="text">{{
              tab.label
            }}</el-button>
          </div>
        </el-aside>
        <el-main class="personal-main"> </el-main>
      </el-container>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { User } from "@element-plus/icons-vue";
import { useHead } from "nuxt/app";

useHead({
  title: "个人中心",
});

const user = ref({
  username: "浪兎兎",
  level: 8,
  signature: "这个人很懒，什么都没有写。",
  followers: 456,
  following: 123,
  favorites: 32,
});

const tabs = ref([
  { name: "posts", label: "我的帖子", component: "" },
  { name: "comments", label: "我的评论", component: "" },
  { name: "favorites", label: "我的收藏", component: "" },
  { name: "followers", label: "我的关注", component: "" },
  { name: "following", label: "我的粉丝", component: "" },
  { name: "editProfile", label: "编辑资料", component: "" },
  { name: "settings", label: "账号设置", component: "" },
]);
</script>

<style scoped>
.personal-center {
  max-width: 1250px;
  margin: 40px auto;
  padding: 24px;
  background: #f7f8fa;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}
.profile-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 2px 12px rgba(33, 150, 243, 0.06);
  margin-bottom: 32px;
}
.avatar {
  margin-right: 32px;
}
.profile-info {
  flex: 1;
}
.username {
  font-size: 22px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
}
.signature {
  font-size: 15px;
  color: #888;
  margin-bottom: 12px;
}
.level-badge {
  margin-bottom: 16px;
}
.profile-stats {
  display: flex;
  gap: 32px;
}
.profile-stats div {
  text-align: center;
}
.stat-num {
  font-size: 18px;
  font-weight: 600;
  color: #1976d2;
  display: block;
}
.stat-label {
  font-size: 13px;
  color: #888;
}
.personal-actions {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(33, 150, 243, 0.06);
  padding: 24px;
}
.post-list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
}
.post-card {
  width: 320px;
  min-height: 80px;
  border-radius: 8px;
}
.post-title {
  font-size: 16px;
  font-weight: 500;
  color: #222;
  margin-bottom: 6px;
}
.post-content {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}
.post-time {
  font-size: 12px;
  color: #bbb;
  text-align: right;
}
.edit-btn {
  margin-left: 20px;
}
.personal-aside {
  background: #f5f7fa;
  padding: 20px;
  border-radius: 8px;
}
.personal-main {
  padding: 20px;
  background: #fafafa;
  border-radius: 8px;
  margin-left: 20px;
}
.personal-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  text-align: center;
  align-items: center;
}
.personal-tab-btn {
  font-size: 16px;
  color: #333;
  text-align: center;
  padding: 10px 0;
  width: 80%;
  border-radius: 6px;
  transition: background-color 0.3s, color 0.3s;
  margin: 3px;
}
@media (max-width: 768px) {
  .personal-center {
    padding: 16px;
  }
  .profile-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .avatar {
    margin-right: 0;
    margin-bottom: 16px;
  }
  .profile-stats {
    justify-content: space-between;
    width: 100%;
    margin-top: 16px;
  }
  .edit-btn {
    margin-left: 0;
    margin-top: 16px;
    width: 100%;
    text-align: center;
  }
  .personal-aside {
    width: 100%;
    margin-bottom: 20px;
  }
  .personal-main {
    margin-left: 0;
  }
}
</style>